package com.ushier.shop.fruits.bean;

public class ResponseMessageBean<T> {

    private int status;

    private String message;

    private T data;

    public static <T> ResponseMessageBean success(T t){
        ResponseMessageBean bean = new ResponseMessageBean();
        bean.setData(t);
        bean.setStatus(0);
        return bean;
    }

    public static <T> ResponseMessageBean success(T t, String message){
        ResponseMessageBean bean = new ResponseMessageBean();
        bean.setData(t);
        bean.setStatus(0);
        bean.setMessage(message);
        return bean;
    }

    public static <T> ResponseMessageBean success(){
        ResponseMessageBean bean = new ResponseMessageBean();
        bean.setStatus(0);
        return bean;
    }

    public static <T> ResponseMessageBean error(String message){
        ResponseMessageBean bean = new ResponseMessageBean();
        bean.setMessage(message);
        bean.setStatus(-1);
        return bean;
    }


    @Override
    public String toString() {
        return "ResponseMessageBean{" +
                "status=" + status +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
